#ifndef ROLEMANAGERAPI_H
#define ROLEMANAGERAPI_H

#include <QObject>
#include <QMainWindow>
#include <QtNetwork>
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <Utils.h>
#include <config.h>
#include <QMessageBox>

class RoleManagerApi : public QObject
{
    Q_OBJECT
public:
    RoleManagerApi(QObject *parent = nullptr);

    //查询参数列表
    QByteArray* list(int pageNum,int pageSize,QString roleName = "",
                        QString roleKey = "",QString status = "",
                        QString beginTime = "",QString endTime = "");
    //查询状态字典
    QByteArray* sys_normal_disable();
    //查询菜单列表
    QByteArray* treeSelect();
    //新增
    QByteArray* addRole(Role *role);
    //更新
    QByteArray* updateRole(Role *role);
    //通过id查询角色
    QByteArray* getById(QString id);
    //通过id查询角色菜单权限
    QByteArray* getMenuById(QString id);
    //删除
    QByteArray* deleteItems(QString ids);
    //改变状态
    QByteArray* changeStatus(QString id,QString status);
    //部门树
    QByteArray* deptTree(QString id);

    //分匹配用户界面查询列表
    QByteArray* allocatedList(int pageNum,int pageSize,QString roleId,
                              QString userName,QString phone);
    QByteArray* unallocatedList(int pageNum,int pageSize,QString roleId,
                              QString userName,QString phone);
    //取消角色授权
    QByteArray* cancelAuth(QString userId,QString roleId);
    //批量取消授权
    QByteArray* cancelAll(QString roleId,QString ids);
    //批量授权
    QByteArray* selectAll(QString roleId,QString ids);
    //数据权限
    QByteArray* dataScope(Role role);

private:
    QString baseUrl ;
    QNetworkRequest request;
    QNetworkAccessManager *manager ;
    QByteArray *data = nullptr;
    Utils utils;
private slots:
//    void test();
};

#endif // ROLEMANAGERAPI_H
